//
//  RMMMoneyShareView.m
//  Romomo
//
//  Created by puman on 2017/3/23.
//  Copyright © 2017年 mazegong. All rights reserved.
//

#import "RMMMoneyShareView.h"

@implementation RMMMoneyShareView
- (instancetype)initWithFrame:(CGRect)frame{
    if ([super initWithFrame:frame]) {
        UIView *view = [[UIView alloc] initWithFrame:CGRectMake(20, 100 + (self.width - 30 - 100), self.width - 40, 100)];
        view.backgroundColor = kWhiteColor;
        view.layer.masksToBounds = YES;
        view.layer.cornerRadius = 3;
        [self addSubview:view];

        CGFloat width = (view.width - 30) / 2.0;
        
        self.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.6];
        UIImageView *imageV = [[UIImageView alloc] initWithFrame:CGRectMake(15, 100, self.width - 30, self.width - 30 - 50)];
        imageV.image = [UIImage imageNamed:@"红包封面@3x"];
        [self addSubview:imageV];
        
        UIImageView *subImageV = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, imageV.width, imageV.width * (471 / 813.0))];
        subImageV.image = [UIImage imageNamed:@"装饰钱币@3x"];
        [imageV addSubview:subImageV];
        
        for (int i = 0; i < 2; i++) {
            UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, subImageV.bottom + kRow + kMaric * i, imageV.width, kMaric)];
            label.textAlignment = NSTextAlignmentCenter;
            [imageV addSubview:label];
            
            UIButton *button = [UIButton buttonWithType:(UIButtonTypeCustom)];
            button.frame = CGRectMake(15 + width * i, 50, width, 50);
            [view addSubview:button];

            if (i == 0) {
                [button setTitle:@"朕乏了" forState:(UIControlStateNormal)];
                [button setTitleColor:COLORFROMCODE(0x9B9B9B, 1) forState:(UIControlStateNormal)];
                label.textColor = kWhiteColor;
                label.text = @"恭喜您获得10个红包可以分享";
                label.font = kFont(16);
                BUTTON_S(button, cancel);
            } else {
                _button = button;
                [button setTitle:@"发红包" forState:(UIControlStateNormal)];
                [button setTitleColor:[UIColor redColor] forState:(UIControlStateNormal)];
                label.textColor = RGBA(241, 245, 144, 1);
                label.font = kFont(13);
                label.text = @"分享红包给好友,红包可用于享受折扣优惠哦~";
            }
        }

    }
    return self;
}
- (void)cancel{
    self.hidden = YES;
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
